fsck: Not an error to have 1-linked objects, also print HEAD
authorColin Walters <walters@verbum.org>
Sat, 15 Oct 2011 02:08:33 +0000 (22:08 -0400)
committerColin Walters <walters@verbum.org>
Sat, 15 Oct 2011 02:10:06 +0000 (22:10 -0400)
src/ht-builtin-fsck.c

index b47d9322d1ded3401681549bace2f3a5eaef29be..abf6ecb63c6ce4324a6c2f059ad9c8981a4259aa 100644 (file)
@@ -46,7 +46,6 @@ object_iter_callback (HacktreeRepo  *repo,
                       gpointer       user_data)
 {
   HtFsckData *data = user_data;
-  guint32 nlinks;
   struct stat stbuf;
   GChecksum *checksum = NULL;
   GError *error = NULL;
@@ -57,10 +56,9 @@ object_iter_callback (HacktreeRepo  *repo,
   dirname = g_path_get_dirname (path);
   checksum_prefix = g_path_get_basename (dirname);
   
-  nlinks = g_file_info_get_attribute_uint32 (file_info, "unix::nlink");
-
-  if (nlinks < 2 && !quiet)
-    g_printerr ("note: floating object: %s\n", path);
+  /* nlinks = g_file_info_get_attribute_uint32 (file_info, "unix::nlink");
+     if (nlinks < 2 && !quiet)
+     g_printerr ("note: floating object: %s\n", path); */
 
   if (!hacktree_stat_and_checksum_file (-1, path, &checksum, &stbuf, &error))
     goto out;
@@ -94,6 +92,7 @@ hacktree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error
   HtFsckData data;
   gboolean ret = FALSE;
   HacktreeRepo *repo = NULL;
+  const char *head;
 
   context = g_option_context_new ("- Check the repository for consistency");
   g_option_context_add_main_entries (context, options, NULL);
@@ -113,6 +112,13 @@ hacktree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error
   if (!hacktree_repo_iter_objects (repo, object_iter_callback, &data, error))
     goto out;
 
+  head = hacktree_repo_get_head (repo);
+  if (!head)
+    {
+      if (!quiet)
+        g_printerr ("No HEAD file\n");
+    }
+
   if (!quiet)
     g_printerr ("Total Objects: %u\n", data.n_objects);